﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Forma
{
    public partial class Form1 : Form
    {
        Komunikacija k;

        public Form1()
        {
            InitializeComponent();
            this.CenterToScreen();
        }

        private void unosMestaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new UnosMesta(k).ShowDialog();
        }

        private void prikazMestaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new PrikazMesta(k).ShowDialog();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            k = new Komunikacija();
            if (k.PoveziSaServerom())
            {
                MessageBox.Show("Uspesna konekcija");
            }
            else
            {
                MessageBox.Show("Neuspesna konekcija");
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            k.Zatvori();
        }

        private void posebnaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new FrmPosebna(k).ShowDialog();
        }
    }
}
